package com.example.springbootcourse.mapper;

import com.example.springbootcourse.pojo.Role;
import com.example.springbootcourse.pojo.RoleExample;
import com.example.springbootcourse.req.RoleReq;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMapper {
    int countByExample(RoleExample example);

    int deleteByExample(RoleExample example);

    int deleteByPrimaryKey(String roleid);

    int insert(Role record);

    int insertSelective(Role record);

    List<Role> selectByExample(RoleExample example);

    Role selectByPrimaryKey(String roleid);

    int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

    @Select("SELECT r.*, p.power FROM role r, power p WHERE r.powerid = p.roleid")
    List<RoleReq> queryRoleAndPower();
}